<?php 
require_once 'includes/funciones.php';
conexion();
require_once('recaptchalib.php');
require_once 'is_login.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title><?php titulo();?></title>
<link rel="STYLESHEET" type="text/css" href="estilo.css">
<link rel="shortcut icon" href="favicon.ico">

<!-- Errores jaquery -->

<link rel="stylesheet" href="../plugins/jqtransform/jqtransformplugin/jqtransform.css" type="text/css" media="all" />
<script type="text/javascript" src="plugins/jquery.js"></script>
<script type="text/javascript" src="plugins/jquery_validate/jquery.validate.js"></script>

<script>
  $(document).ready(function(){
		
	$("#classifiedsForm").validate({
		rules: {			
			categorie: {
				required: true,
				},
			title: {
				required: true,
					},
			description: {
				required: true,
				},
		},				
					
                
		messages: {
			categorie: {
				required: "Debe seleccionar una categoria"
				
						},

            title:{
                required: "<br>Debe colocar un título"
                    },
			description: "<br>Debe colocar una descripción"		
                    
			}
	});
	
  });
 
</script>

<!-- /ERRORES -->


<!-- Editor TinyMce -->
<!-- <script type="text/javascript" src="plugins/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
        mode : "exact",
        elements : "description",
        theme : "advanced",
        theme_advanced_buttons1:"bold,italic,|,undo,redo",
        theme_advanced_buttons2:"",
        theme_advanced_buttons3:""

});
</script> -->


</head>

<body>


<div id="contenedor">

        <?php
        require_once("includes/encabezado.php");
        ?>
        <!--fin de encabezado-->

<div id="contentleft">

<?php
        include_once("includes/banner.php");
?>

        
<div id="contentcenter">

    <div class="titulo">Cargar Clasificado </div>
    <br/>
    
    <form  id="classifiedsForm" name="classifiedsForm" action="control_clasificado.php" method="post" enctype="multipart/form-data">        
        <fieldset style="width:550px" class="fieldsetfront">
        <legend>Ingrese los datos del clasificado</legend>
        
        <table width="500" border="0" align="center">
       <tr>
            <td width="50">Categoria: </td>
            <td width="80">
                           <select name="categorie" class="required">
                           <option value ="">Elija categoria</option>
                                
                                <?php 
                                $concla= mysql_query("SELECT * FROM categories where id_grupos = 2");
                                while($rowconcla=mysql_fetch_array($concla))
                                        {
                                                echo '<option value="'.$rowconcla['id'].'">'.$rowconcla['description'].' </option>';
                                        }
                                ?>
                                </select>
                                </td>
        </tr>
                      <br/>
                      <tr>
            			<td width="50">T&iacute;tulo:</td>  
                         <?php 
                                if(!empty($_SESSION['captcha']['title'])){
                                echo '<td><textarea id="title" name="title" onkeyup="if (this.value.length == 100) this.disabled = true;" cols="30" rows="2">'.$_SESSION['captcha']['title'].'</textarea></td>';
                                $_SESSION['captcha']['title']="";
                                }
                                else{
                                        echo '<td><textarea id="title" name="title" onkeyup="if (this.value.length == 100) this.disabled = true;" cols="30" rows="4"></textarea></td>';
                                }
                                
                           ?>
                        </tr>   
                        <tr>
                        	<td width="50"></>Descripción:</td> 
                                <?php 
                                if(!empty($_SESSION['captcha']['description'])){
                                echo '<td><textarea id ="description" name="description" cols="30" rows="4">'.$_SESSION['captcha']['description'].'</textarea></td>';
                                $_SESSION['captcha']['description']="";        
                                } else{
                                echo '<td><textarea id="description" name="description" cols="30" rows="4"></textarea></td>';
                                }
                                ?>
                        </tr>                                    
                                                        
                        <?php
                 		$estado = $_SESSION["errorcargararchivo"];
						switch ($estado){
							case "permiso":
							echo '<span class="error">Archivo error: Verifique permisos en carpeta</span><br>';
							break;
							case "extensiones":
							echo '<span class="error">Archivo error: Extension no permitida</span><br>';
							break;
									            		   
							}
						$_SESSION["errorcargararchivo"] = " ";

				?>
						<tr>
							<td width="50">Imagenes</td>
		                 <td><input type="file" name="imagen1"></input></td>
		                </tr>
		                <tr>
		                	<td width="50"></td>
		                     <td><input type="file" name="imagen2"></input></td>
		                </tr>
		                <tr>
		                	 <td width="50"></td>		                	 
		                     <td><input type="file" name="imagen3"></input></td>
		                </tr> 
		                <input type="hidden" name="MAX_FILE_SIZE" value="1000000">
		                <br>
		                <br>   
                                                     
                <?php                                                                                                                                
               	      // Get a key from https://www.google.com/recaptcha/admin/create
                      $publickey = "6LeZRcUSAAAAALJFxqAp80ma0et7xmVNp78VA9Ot";
                      echo '<tr>';
                      	echo '<td width="50">';
                      	echo '<td>'.recaptcha_get_html($publickey).'</td>';
                      
                      	
                      if(!empty( $_SESSION['captcha']['error'])){
                             echo '<div class="error">'.$_SESSION['captcha']['error'].'</div>';
                             $_SESSION['captcha']['error']="";
                             
                   }
                   
                   	echo '</tr>';
                  ?>
                  
                	 <tr valign="top">
            			<td colspan="2">
              				<div class="boton" align="center"><br />
		        	        	<input name="boton" type="hidden" id="boton" value="1"></input>
                                <input class="buttonfront" type="submit" value="Aceptar"><br>                      
		        	       	</div>
        		    	</td>
          			</tr>
                                                                                           
		         </table>   
                   
              
          </form>               
        
 </fieldset>                  
                



</div> <!-- Cierre contentcenter -->


</div> <!-- Cierre contentleft -->
 



<div id="menuderecha" >
        <?php
        include_once("includes/menuderecha.php");
        ?>
</div>  


<div id="publicidadbottom">
        <?php 
        include_once 'includes/publicidadbottom.php';   
        ?>
</div>


<div id="piepagina">
  <?php
  include_once 'includes/pie.php';
  ?>
</div> 
  
  
  
  
</div> <!--fin de Contenedor-->


</body>
</html>
